

from rest_framework import serializers
from goods.models import SKUImage,SKU




class SKUSimpleSerializer(serializers.ModelSerializer):
    class Meta:
        model = SKU
        fields = [
            'id',
            'name'
        ]




class ImageModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = SKUImage
        fields = [
            'id',
            'sku',
            
            # 文件类型字段，序列化的结果
            # 取决于文件存储后端url函数返回的结果！
            'image'
        ]
